package com.analysis.apresunday.service.impl;

import com.analysis.apresunday.mapper.AnalysisScaleMapper;
import com.analysis.apresunday.entity.po.AnalysisScale;
import com.analysis.apresunday.service.AnalysisScaleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class AnalysisScaleServiceImpl extends ServiceImpl<AnalysisScaleMapper, AnalysisScale> implements AnalysisScaleService {


    @Override
    public List<AnalysisScale> getStatisticList() {
        QueryWrapper<AnalysisScale> query = new QueryWrapper<>();
        query.orderByDesc("id");
        query.last("limit 6");
        List<AnalysisScale> analysisScales = baseMapper.selectList(query);
        Collections.reverse(analysisScales);
        return analysisScales;
    }
}
